﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class PlayerController : MonoBehaviour {
	public Text Count;
	public int score=0;
	
	private Rigidbody rb;

	// Use this for initialization
	void Start () {
		rb = GetComponent<Rigidbody> ();
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	void FixedUpdate (){
		float moveH = Input.GetAxis ("Horizontal");
		float moveV = Input.GetAxis ("Vertical");

		Vector3 direction = new Vector3 (moveH, 0, moveV);
		Vector3 force = direction * 15;
		rb.AddForce (force);
	}
	void OnTriggerEnter(Collider collider){
		collider.gameObject.SetActive (false);
		Destroy (collider.gameObject);
		
		score += 10;
		Count.text=score+"";
	}
}
